
execute store result score @s advm_power run data get entity @s Inventory[-1].tag.power

execute if score @s advm_useSlot matches 0 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:0b}].tag.power_cost
execute if score @s advm_useSlot matches 0 run execute if data entity @s Inventory[{Slot:0b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 0 run execute if data entity @s Inventory[{Slot:0b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 1 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:1b}].tag.power_cost
execute if score @s advm_useSlot matches 1 run execute if data entity @s Inventory[{Slot:1b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 1 run execute if data entity @s Inventory[{Slot:1b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 2 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:2b}].tag.power_cost
execute if score @s advm_useSlot matches 2 run execute if data entity @s Inventory[{Slot:2b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 2 run execute if data entity @s Inventory[{Slot:2b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 3 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:3b}].tag.power_cost
execute if score @s advm_useSlot matches 3 run execute if data entity @s Inventory[{Slot:3b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 3 run execute if data entity @s Inventory[{Slot:3b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 4 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:4b}].tag.power_cost
execute if score @s advm_useSlot matches 4 run execute if data entity @s Inventory[{Slot:4b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 4 run execute if data entity @s Inventory[{Slot:4b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 5 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:5b}].tag.power_cost
execute if score @s advm_useSlot matches 5 run execute if data entity @s Inventory[{Slot:5b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 5 run execute if data entity @s Inventory[{Slot:5b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 6 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:6b}].tag.power_cost
execute if score @s advm_useSlot matches 6 run execute if data entity @s Inventory[{Slot:6b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 6 run execute if data entity @s Inventory[{Slot:6b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 7 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:7b}].tag.power_cost
execute if score @s advm_useSlot matches 7 run execute if data entity @s Inventory[{Slot:7b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 7 run execute if data entity @s Inventory[{Slot:7b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 8 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:8b}].tag.power_cost
execute if score @s advm_useSlot matches 8 run execute if data entity @s Inventory[{Slot:8b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 8 run execute if data entity @s Inventory[{Slot:8b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 9 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:9b}].tag.power_cost
execute if score @s advm_useSlot matches 9 run execute if data entity @s Inventory[{Slot:9b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 9 run execute if data entity @s Inventory[{Slot:9b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 10 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:10b}].tag.power_cost
execute if score @s advm_useSlot matches 10 run execute if data entity @s Inventory[{Slot:10b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 10 run execute if data entity @s Inventory[{Slot:10b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 11 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:11b}].tag.power_cost
execute if score @s advm_useSlot matches 11 run execute if data entity @s Inventory[{Slot:11b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 11 run execute if data entity @s Inventory[{Slot:11b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 12 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:12b}].tag.power_cost
execute if score @s advm_useSlot matches 12 run execute if data entity @s Inventory[{Slot:12b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 12 run execute if data entity @s Inventory[{Slot:12b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 13 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:13b}].tag.power_cost
execute if score @s advm_useSlot matches 13 run execute if data entity @s Inventory[{Slot:13b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 13 run execute if data entity @s Inventory[{Slot:13b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 14 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:14b}].tag.power_cost
execute if score @s advm_useSlot matches 14 run execute if data entity @s Inventory[{Slot:14b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 14 run execute if data entity @s Inventory[{Slot:14b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 15 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:15b}].tag.power_cost
execute if score @s advm_useSlot matches 15 run execute if data entity @s Inventory[{Slot:15b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 15 run execute if data entity @s Inventory[{Slot:15b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 16 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:16b}].tag.power_cost
execute if score @s advm_useSlot matches 16 run execute if data entity @s Inventory[{Slot:16b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 16 run execute if data entity @s Inventory[{Slot:16b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 17 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:17b}].tag.power_cost
execute if score @s advm_useSlot matches 17 run execute if data entity @s Inventory[{Slot:17b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 17 run execute if data entity @s Inventory[{Slot:17b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 18 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:18b}].tag.power_cost
execute if score @s advm_useSlot matches 18 run execute if data entity @s Inventory[{Slot:18b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 18 run execute if data entity @s Inventory[{Slot:18b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 19 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:19b}].tag.power_cost
execute if score @s advm_useSlot matches 19 run execute if data entity @s Inventory[{Slot:19b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 19 run execute if data entity @s Inventory[{Slot:19b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 20 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:20b}].tag.power_cost
execute if score @s advm_useSlot matches 20 run execute if data entity @s Inventory[{Slot:20b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 20 run execute if data entity @s Inventory[{Slot:20b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 21 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:21b}].tag.power_cost
execute if score @s advm_useSlot matches 21 run execute if data entity @s Inventory[{Slot:21b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 21 run execute if data entity @s Inventory[{Slot:21b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 22 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:22b}].tag.power_cost
execute if score @s advm_useSlot matches 22 run execute if data entity @s Inventory[{Slot:22b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 22 run execute if data entity @s Inventory[{Slot:22b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 23 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:23b}].tag.power_cost
execute if score @s advm_useSlot matches 23 run execute if data entity @s Inventory[{Slot:23b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 23 run execute if data entity @s Inventory[{Slot:23b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 24 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:24b}].tag.power_cost
execute if score @s advm_useSlot matches 24 run execute if data entity @s Inventory[{Slot:24b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 24 run execute if data entity @s Inventory[{Slot:24b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 25 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:25b}].tag.power_cost
execute if score @s advm_useSlot matches 25 run execute if data entity @s Inventory[{Slot:25b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 25 run execute if data entity @s Inventory[{Slot:25b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 26 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:26b}].tag.power_cost
execute if score @s advm_useSlot matches 26 run execute if data entity @s Inventory[{Slot:26b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 26 run execute if data entity @s Inventory[{Slot:26b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 27 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:27b}].tag.power_cost
execute if score @s advm_useSlot matches 27 run execute if data entity @s Inventory[{Slot:27b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 27 run execute if data entity @s Inventory[{Slot:27b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 28 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:28b}].tag.power_cost
execute if score @s advm_useSlot matches 28 run execute if data entity @s Inventory[{Slot:28b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 28 run execute if data entity @s Inventory[{Slot:28b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 29 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:29b}].tag.power_cost
execute if score @s advm_useSlot matches 29 run execute if data entity @s Inventory[{Slot:29b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 29 run execute if data entity @s Inventory[{Slot:29b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 30 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:30b}].tag.power_cost
execute if score @s advm_useSlot matches 30 run execute if data entity @s Inventory[{Slot:30b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 30 run execute if data entity @s Inventory[{Slot:30b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 31 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:31b}].tag.power_cost
execute if score @s advm_useSlot matches 31 run execute if data entity @s Inventory[{Slot:31b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 31 run execute if data entity @s Inventory[{Slot:31b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 32 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:32b}].tag.power_cost
execute if score @s advm_useSlot matches 32 run execute if data entity @s Inventory[{Slot:32b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 32 run execute if data entity @s Inventory[{Slot:32b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 33 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:33b}].tag.power_cost
execute if score @s advm_useSlot matches 33 run execute if data entity @s Inventory[{Slot:33b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 33 run execute if data entity @s Inventory[{Slot:33b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 34 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:34b}].tag.power_cost
execute if score @s advm_useSlot matches 34 run execute if data entity @s Inventory[{Slot:34b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 34 run execute if data entity @s Inventory[{Slot:34b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 35 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:35b}].tag.power_cost
execute if score @s advm_useSlot matches 35 run execute if data entity @s Inventory[{Slot:35b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 35 run execute if data entity @s Inventory[{Slot:35b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 100 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:100b}].tag.power_cost
execute if score @s advm_useSlot matches 100 run execute if data entity @s Inventory[{Slot:100b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 100 run execute if data entity @s Inventory[{Slot:100b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 101 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:101b}].tag.power_cost
execute if score @s advm_useSlot matches 101 run execute if data entity @s Inventory[{Slot:101b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 101 run execute if data entity @s Inventory[{Slot:101b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 102 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:102b}].tag.power_cost
execute if score @s advm_useSlot matches 102 run execute if data entity @s Inventory[{Slot:102b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 102 run execute if data entity @s Inventory[{Slot:102b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_useSlot matches 103 run execute store result score @s advm_power_cost run data get entity @s Inventory[{Slot:103b}].tag.power_cost
execute if score @s advm_useSlot matches 103 run execute if data entity @s Inventory[{Slot:103b}].tag.electricalAttribute.hyperload run scoreboard players operation @s advm_power_cost += @s advm_power_cost
execute if score @s advm_useSlot matches 103 run execute if data entity @s Inventory[{Slot:103b}].tag.electricalAttribute.efficient_use run scoreboard players operation @s advm_power_cost /= @s advm_efficient_use_devide

execute if score @s advm_power matches 1.. run scoreboard players operation @s advm_power -= @s advm_power_cost
execute if score @s advm_power matches ..0 run scoreboard players set @s advm_power 0
execute store result storage advm:temp power int 1 run scoreboard players get @s advm_power
item modify entity @s weapon.offhand advm:set_power
execute as @s[nbt={Inventory:[{Slot:-106b,tag:{id:"advm:battery"}}]}] if score @s advm_power matches ..0 run loot replace entity @s weapon.offhand loot advm:battery_used_up
